
def BubbleSort():
        n = len(arr)-1
        for i in range(len(arr)-1):
            for j in range(n):
                if arr[j]>arr[j+1]:
                    arr[j],arr[j+1]=arr[j+1],arr[j]
            n-=1
        return  arr


def BubbleSort2():
        Swap = True
        n = len(arr)
        while Swap:
            Swap = False
            for j in range(n-1):
                if arr[j]>arr[j+1]:
                    arr[j],arr[j+1]=arr[j+1],arr[j]
                    Swap = True
            n-=1
        return arr
arr=[4,5,7,1,2,3,9,2,8]
print(BubbleSort2())

input()
print()